.class public Lcom/hyphenate/chat/MessageEncoder;
.super Ljava/lang/Object;


# static fields
.field public static final ATTR_ACTION:Ljava/lang/String; = "action"

.field public static final ATTR_ADDRESS:Ljava/lang/String; = "addr"

.field public static final ATTR_EXT:Ljava/lang/String; = "ext"

.field public static final ATTR_FILENAME:Ljava/lang/String; = "filename"

.field public static final ATTR_FILE_LENGTH:Ljava/lang/String; = "file_length"

.field public static final ATTR_FROM:Ljava/lang/String; = "from"

.field public static final ATTR_IMG_HEIGHT:Ljava/lang/String; = "height"

.field public static final ATTR_IMG_WIDTH:Ljava/lang/String; = "width"

.field public static final ATTR_LATITUDE:Ljava/lang/String; = "lat"

.field public static final ATTR_LENGTH:Ljava/lang/String; = "length"

.field public static final ATTR_LOCALURL:Ljava/lang/String; = "localurl"

.field public static final ATTR_LONGITUDE:Ljava/lang/String; = "lng"

.field public static final ATTR_MSG:Ljava/lang/String; = "msg"

.field public static final ATTR_PARAM:Ljava/lang/String; = "param"

.field public static final ATTR_SECRET:Ljava/lang/String; = "secret"

.field public static final ATTR_SIZE:Ljava/lang/String; = "size"

.field public static final ATTR_THUMBNAIL:Ljava/lang/String; = "thumb"

.field public static final ATTR_THUMBNAIL_SECRET:Ljava/lang/String; = "thumb_secret"

.field public static final ATTR_THUMB_LOCALURL:Ljava/lang/String; = "thumblocalurl"

.field public static final ATTR_TO:Ljava/lang/String; = "to"

.field public static final ATTR_TYPE:Ljava/lang/String; = "type"

.field private static final ATTR_TYPE_CMD:Ljava/lang/String; = "cmd"

.field private static final ATTR_TYPE_IMG:Ljava/lang/String; = "img"

.field private static final ATTR_TYPE_LOCATION:Ljava/lang/String; = "loc"

.field private static final ATTR_TYPE_TXT:Ljava/lang/String; = "txt"

.field private static final ATTR_TYPE_VIDEO:Ljava/lang/String; = "video"

.field private static final ATTR_TYPE_VOICE:Ljava/lang/String; = "audio"

.field private static final ATTR_TYPE_file:Ljava/lang/String; = "file"

.field public static final ATTR_URL:Ljava/lang/String; = "url"

.field private static final TAG:Ljava/lang/String; = "encoder"


# direct methods
.method public constructor <init>()V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static getMsgFromJson(Ljava/lang/String;)Lcom/hyphenate/chat/EMMessage;
    .locals 11

    const/4 v6, 0x0

    :try_start_0
    new-instance v8, Lorg/json/JSONObject;

    invoke-direct {v8, p0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    new-instance v9, Lcom/hyphenate/chat/EMContact;

    const-string/jumbo v0, "from"

    invoke-virtual {v8, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-direct {v9, v0}, Lcom/hyphenate/chat/EMContact;-><init>(Ljava/lang/String;)V

    new-instance v10, Lcom/hyphenate/chat/EMContact;

    const-string/jumbo v0, "to"

    invoke-virtual {v8, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-direct {v10, v0}, Lcom/hyphenate/chat/EMContact;-><init>(Ljava/lang/String;)V

    const-string/jumbo v0, "bodies"

    invoke-virtual {v8, v0}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v0

    invoke-virtual {v0}, Lorg/json/JSONArray;->length()I

    move-result v1

    const/4 v2, 0x1

    if-ge v1, v2, :cond_0

    const-string/jumbo v0, "encoder"

    const-string/jumbo v1, "wrong msg without body"

    invoke-static {v0, v1}, Lcom/hyphenate/util/EMLog;->d(Ljava/lang/String;Ljava/lang/String;)V

    move-object v0, v6

    :goto_0
    return-object v0

    :cond_0
    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v4

    const-string/jumbo v0, "type"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    sget-object v0, Lcom/hyphenate/chat/EMMessage$Type;->TXT:Lcom/hyphenate/chat/EMMessage$Type;

    const-string/jumbo v2, "txt"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_4

    sget-object v0, Lcom/hyphenate/chat/EMMessage$Type;->TXT:Lcom/hyphenate/chat/EMMessage$Type;

    :cond_1
    :goto_1
    iget-object v2, v9, Lcom/hyphenate/chat/EMContact;->username:Ljava/lang/String;

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v3

    invoke-virtual {v3}, Lcom/hyphenate/chat/EMClient;->getCurrentUser()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_a

    invoke-static {v0}, Lcom/hyphenate/chat/EMMessage;->createSendMessage(Lcom/hyphenate/chat/EMMessage$Type;)Lcom/hyphenate/chat/EMMessage;

    move-result-object v7

    :goto_2
    const-string/jumbo v0, "txt"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_b

    const-string/jumbo v0, "msg"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string/jumbo v1, "%22"

    const-string/jumbo v2, "\""

    invoke-virtual {v0, v1, v2}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    new-instance v1, Lcom/hyphenate/chat/EMTextMessageBody;

    invoke-direct {v1, v0}, Lcom/hyphenate/chat/EMTextMessageBody;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7, v1}, Lcom/hyphenate/chat/EMMessage;->addBody(Lcom/hyphenate/chat/EMMessageBody;)V

    :cond_2
    :goto_3
    if-eqz v7, :cond_3

    invoke-virtual {v9}, Lcom/hyphenate/chat/EMContact;->getUsername()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v7, v0}, Lcom/hyphenate/chat/EMMessage;->setFrom(Ljava/lang/String;)V

    invoke-virtual {v10}, Lcom/hyphenate/chat/EMContact;->getUsername()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v7, v0}, Lcom/hyphenate/chat/EMMessage;->setTo(Ljava/lang/String;)V

    :cond_3
    const-string/jumbo v0, "ext"

    invoke-virtual {v8, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_23

    const-string/jumbo v0, "ext"

    invoke-virtual {v8, v0}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v2

    invoke-virtual {v2}, Lorg/json/JSONObject;->keys()Ljava/util/Iterator;

    move-result-object v3

    :goto_4
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_23

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    invoke-virtual {v2, v0}, Lorg/json/JSONObject;->get(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    instance-of v4, v1, Ljava/lang/String;

    if-eqz v4, :cond_1e

    check-cast v1, Ljava/lang/String;

    invoke-virtual {v7, v0, v1}, Lcom/hyphenate/chat/EMMessage;->setAttribute(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_4

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    move-object v0, v6

    goto/16 :goto_0

    :cond_4
    :try_start_1
    const-string/jumbo v2, "img"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_5

    sget-object v0, Lcom/hyphenate/chat/EMMessage$Type;->IMAGE:Lcom/hyphenate/chat/EMMessage$Type;

    goto/16 :goto_1

    :cond_5
    const-string/jumbo v2, "file"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_6

    sget-object v0, Lcom/hyphenate/chat/EMMessage$Type;->FILE:Lcom/hyphenate/chat/EMMessage$Type;

    goto/16 :goto_1

    :cond_6
    const-string/jumbo v2, "video"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_7

    sget-object v0, Lcom/hyphenate/chat/EMMessage$Type;->VIDEO:Lcom/hyphenate/chat/EMMessage$Type;

    goto/16 :goto_1

    :cond_7
    const-string/jumbo v2, "audio"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_8

    sget-object v0, Lcom/hyphenate/chat/EMMessage$Type;->VOICE:Lcom/hyphenate/chat/EMMessage$Type;

    goto/16 :goto_1

    :cond_8
    const-string/jumbo v2, "loc"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_9

    sget-object v0, Lcom/hyphenate/chat/EMMessage$Type;->LOCATION:Lcom/hyphenate/chat/EMMessage$Type;

    goto/16 :goto_1

    :cond_9
    const-string/jumbo v2, "cmd"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_1

    sget-object v0, Lcom/hyphenate/chat/EMMessage$Type;->CMD:Lcom/hyphenate/chat/EMMessage$Type;

    goto/16 :goto_1

    :cond_a
    invoke-static {v0}, Lcom/hyphenate/chat/EMMessage;->createReceiveMessage(Lcom/hyphenate/chat/EMMessage$Type;)Lcom/hyphenate/chat/EMMessage;

    move-result-object v7

    goto/16 :goto_2

    :cond_b
    const-string/jumbo v0, "img"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_10

    const-string/jumbo v0, "url"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string/jumbo v0, "filename"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    const-string/jumbo v0, "thumb"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_24

    const-string/jumbo v0, "thumb"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    :goto_5
    new-instance v3, Lcom/hyphenate/chat/EMImageMessageBody;

    invoke-direct {v3, v2, v1, v0}, Lcom/hyphenate/chat/EMImageMessageBody;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    const-string/jumbo v0, "localurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_c

    const-string/jumbo v0, "localurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v0}, Lcom/hyphenate/chat/EMImageMessageBody;->setLocalUrl(Ljava/lang/String;)V

    :cond_c
    const-string/jumbo v0, "secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_d

    const-string/jumbo v0, "secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v0}, Lcom/hyphenate/chat/EMImageMessageBody;->setSecret(Ljava/lang/String;)V

    :cond_d
    const-string/jumbo v0, "thumb_secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_e

    const-string/jumbo v0, "thumb_secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v0}, Lcom/hyphenate/chat/EMImageMessageBody;->setThumbnailSecret(Ljava/lang/String;)V

    :cond_e
    const-string/jumbo v0, "size"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_f

    const-string/jumbo v0, "size"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v0

    const-string/jumbo v1, "width"

    invoke-virtual {v0, v1}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v1

    const-string/jumbo v2, "height"

    invoke-virtual {v0, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v0

    invoke-virtual {v3, v1, v0}, Lcom/hyphenate/chat/EMImageMessageBody;->setSize(II)V

    :cond_f
    invoke-virtual {v7, v3}, Lcom/hyphenate/chat/EMMessage;->addBody(Lcom/hyphenate/chat/EMMessageBody;)V

    goto/16 :goto_3

    :cond_10
    const-string/jumbo v0, "file"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_13

    const-string/jumbo v0, "url"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string/jumbo v1, "filename"

    invoke-virtual {v4, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    new-instance v2, Lcom/hyphenate/chat/EMNormalFileMessageBody;

    invoke-direct {v2, v1, v0}, Lcom/hyphenate/chat/EMNormalFileMessageBody;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    const-string/jumbo v0, "file_length"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    int-to-long v0, v0

    invoke-virtual {v2, v0, v1}, Lcom/hyphenate/chat/EMNormalFileMessageBody;->setFileLength(J)V

    const-string/jumbo v0, "localurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_11

    const-string/jumbo v0, "localurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v2, v0}, Lcom/hyphenate/chat/EMNormalFileMessageBody;->setLocalUrl(Ljava/lang/String;)V

    :cond_11
    const-string/jumbo v0, "secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_12

    const-string/jumbo v0, "secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v2, v0}, Lcom/hyphenate/chat/EMNormalFileMessageBody;->setSecret(Ljava/lang/String;)V

    :cond_12
    invoke-virtual {v7, v2}, Lcom/hyphenate/chat/EMMessage;->addBody(Lcom/hyphenate/chat/EMMessageBody;)V

    goto/16 :goto_3

    :cond_13
    const-string/jumbo v0, "video"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_19

    const-string/jumbo v0, "url"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string/jumbo v1, "filename"

    invoke-virtual {v4, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string/jumbo v2, "thumb"

    invoke-virtual {v4, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    const-string/jumbo v3, "length"

    invoke-virtual {v4, v3}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v3

    new-instance v5, Lcom/hyphenate/chat/EMVideoMessageBody;

    invoke-direct {v5, v1, v0, v2, v3}, Lcom/hyphenate/chat/EMVideoMessageBody;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V

    const-string/jumbo v0, "localurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_14

    const-string/jumbo v0, "localurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v5, v0}, Lcom/hyphenate/chat/EMVideoMessageBody;->setLocalUrl(Ljava/lang/String;)V

    :cond_14
    const-string/jumbo v0, "file_length"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_15

    const-string/jumbo v0, "file_length"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getLong(Ljava/lang/String;)J

    move-result-wide v0

    invoke-virtual {v5, v0, v1}, Lcom/hyphenate/chat/EMVideoMessageBody;->setFileLength(J)V

    :cond_15
    const-string/jumbo v0, "thumblocalurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_16

    const-string/jumbo v0, "thumblocalurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v5, v0}, Lcom/hyphenate/chat/EMVideoMessageBody;->setLocalThumb(Ljava/lang/String;)V

    :cond_16
    const-string/jumbo v0, "secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_17

    const-string/jumbo v0, "secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v5, v0}, Lcom/hyphenate/chat/EMVideoMessageBody;->setSecret(Ljava/lang/String;)V

    :cond_17
    const-string/jumbo v0, "thumb_secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_18

    const-string/jumbo v0, "thumb_secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v5, v0}, Lcom/hyphenate/chat/EMVideoMessageBody;->setThumbnailSecret(Ljava/lang/String;)V

    :cond_18
    invoke-virtual {v7, v5}, Lcom/hyphenate/chat/EMMessage;->addBody(Lcom/hyphenate/chat/EMMessageBody;)V

    goto/16 :goto_3

    :cond_19
    const-string/jumbo v0, "audio"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1c

    const-string/jumbo v0, "url"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string/jumbo v1, "filename"

    invoke-virtual {v4, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string/jumbo v2, "length"

    invoke-virtual {v4, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    new-instance v3, Lcom/hyphenate/chat/EMVoiceMessageBody;

    invoke-direct {v3, v1, v0, v2}, Lcom/hyphenate/chat/EMVoiceMessageBody;-><init>(Ljava/lang/String;Ljava/lang/String;I)V

    const-string/jumbo v0, "localurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1a

    const-string/jumbo v0, "localurl"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v0}, Lcom/hyphenate/chat/EMVoiceMessageBody;->setLocalUrl(Ljava/lang/String;)V

    :cond_1a
    const-string/jumbo v0, "secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1b

    const-string/jumbo v0, "secret"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v0}, Lcom/hyphenate/chat/EMVoiceMessageBody;->setSecret(Ljava/lang/String;)V

    :cond_1b
    invoke-virtual {v7, v3}, Lcom/hyphenate/chat/EMMessage;->addBody(Lcom/hyphenate/chat/EMMessageBody;)V

    goto/16 :goto_3

    :cond_1c
    const-string/jumbo v0, "loc"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1d

    const-string/jumbo v0, "addr"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string/jumbo v0, "lat"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getDouble(Ljava/lang/String;)D

    move-result-wide v2

    const-string/jumbo v0, "lng"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getDouble(Ljava/lang/String;)D

    move-result-wide v4

    new-instance v0, Lcom/hyphenate/chat/EMLocationMessageBody;

    invoke-direct/range {v0 .. v5}, Lcom/hyphenate/chat/EMLocationMessageBody;-><init>(Ljava/lang/String;DD)V

    invoke-virtual {v7, v0}, Lcom/hyphenate/chat/EMMessage;->addBody(Lcom/hyphenate/chat/EMMessageBody;)V

    goto/16 :goto_3

    :cond_1d
    const-string/jumbo v0, "cmd"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_2

    goto/16 :goto_3

    :cond_1e
    instance-of v4, v1, Ljava/lang/Integer;

    if-eqz v4, :cond_1f

    check-cast v1, Ljava/lang/Integer;

    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v1

    invoke-virtual {v7, v0, v1}, Lcom/hyphenate/chat/EMMessage;->setAttribute(Ljava/lang/String;I)V

    goto/16 :goto_4

    :cond_1f
    instance-of v4, v1, Ljava/lang/Boolean;

    if-eqz v4, :cond_20

    check-cast v1, Ljava/lang/Boolean;

    invoke-virtual {v1}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v1

    invoke-virtual {v7, v0, v1}, Lcom/hyphenate/chat/EMMessage;->setAttribute(Ljava/lang/String;Z)V

    goto/16 :goto_4

    :cond_20
    instance-of v4, v1, Lorg/json/JSONObject;

    if-eqz v4, :cond_21

    check-cast v1, Lorg/json/JSONObject;

    invoke-virtual {v7, v0, v1}, Lcom/hyphenate/chat/EMMessage;->setAttribute(Ljava/lang/String;Lorg/json/JSONObject;)V

    goto/16 :goto_4

    :cond_21
    instance-of v4, v1, Lorg/json/JSONArray;

    if-eqz v4, :cond_22

    check-cast v1, Lorg/json/JSONArray;

    invoke-virtual {v7, v0, v1}, Lcom/hyphenate/chat/EMMessage;->setAttribute(Ljava/lang/String;Lorg/json/JSONArray;)V

    goto/16 :goto_4

    :cond_22
    const-string/jumbo v0, "msg"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v5, "unknow additonal msg attr:"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v4, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/hyphenate/util/EMLog;->e(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto/16 :goto_4

    :cond_23
    move-object v0, v7

    goto/16 :goto_0

    :cond_24
    move-object v0, v1

    goto/16 :goto_5
.end method
